﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">          
        </asp:ScriptManager>
        <asp:LoginName ID="LoginName1" runat="server" />
        <asp:Label ID="ErrorMessageLabel" runat="server" Text="Label"></asp:Label>
        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
            <ContentTemplate>
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="ObjectDataSource2"
            Height="50px" Width="200px" DataKeyNames="Isbn" AutoGenerateEditButton="True" AutoGenerateInsertButton="True" DefaultMode="Insert" 
            OnItemUpdated="DetailsView1_ItemUpdated" OnItemInserted="DetailsView1_ItemInserted" >
            <Fields>
                <asp:BoundField DataField="Author" HeaderText="Author" SortExpression="Author" />
                <asp:BoundField DataField="Isbn" HeaderText="Isbn" SortExpression="Isbn" />
                <asp:BoundField DataField="BookName" HeaderText="BookName" SortExpression="BookName" />
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" SortExpression="CategoryID" />
                <asp:BoundField DataField="Publisher" HeaderText="Publisher" SortExpression="Publisher" />
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
            </Fields>
        </asp:DetailsView>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DeleteMethod="Delete"
            InsertMethod="Insert" OldValuesParameterFormatString="" SelectMethod="FetchByID"
            TypeName="BookShop.BookController" UpdateMethod="Update">
            <DeleteParameters>
                <asp:Parameter Name="Isbn" Type="Object" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Isbn" Type="String" />
                <asp:Parameter Name="BookName" Type="String" />
                <asp:Parameter Name="Author" Type="String" />
                <asp:Parameter Name="Publisher" Type="String" />
                <asp:Parameter Name="Price" Type="Decimal" />
                <asp:Parameter Name="CategoryID" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
            </UpdateParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="Isbn" PropertyName="SelectedValue"
                    Type="Object" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter Name="Isbn" Type="String" />
                <asp:Parameter Name="BookName" Type="String" />
                <asp:Parameter Name="Author" Type="String" />
                <asp:Parameter Name="Publisher" Type="String" />
                <asp:Parameter Name="Price" Type="Decimal" />
                <asp:Parameter Name="CategoryID" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
            </InsertParameters>
        </asp:ObjectDataSource>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None" 
            OnDataBound="GridView1_DataBound1" AutoGenerateEditButton="True" DataKeyNames="Isbn" AutoGenerateSelectButton="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
            <Columns>
                <asp:BoundField DataField="Author" HeaderText="Author" SortExpression="Author" ReadOnly="True" />
                <asp:BoundField DataField="Isbn" HeaderText="Isbn" SortExpression="Isbn" />
                <asp:BoundField DataField="BookName" HeaderText="BookName" SortExpression="BookName" />
                <asp:BoundField DataField="Publisher" HeaderText="Publisher" SortExpression="Publisher" ReadOnly="True" />
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" ReadOnly="True" />
                <asp:BoundField DataField="Name" HeaderText="Category" SortExpression="Category" />
            </Columns>
            <PagerTemplate>
            <table width="100%">
                    <tr>
                        <td width="70%">
                            <asp:Label ID="MessageLabel" ForeColor="Blue" Text="页码:" runat="server" />
                            <asp:DropDownList ID="PageDropDownList" AutoPostBack="true" OnSelectedIndexChanged="PageDropDownList_SelectedIndexChanged"
                                runat="server" />
                            <asp:LinkButton CommandName="Page" CommandArgument="First" ID="linkBtnFirst" runat="server">首页</asp:LinkButton>
                            <asp:LinkButton CommandName="Page" CommandArgument="Prev" ID="linkBtnPrev" runat="server">上一页</asp:LinkButton>
                            <asp:LinkButton CommandName="Page" CommandArgument="Next" ID="linkBtnNext" runat="server">下一页</asp:LinkButton>
                            <asp:LinkButton CommandName="Page" CommandArgument="Last" ID="linkBtnLast" runat="server">末页</asp:LinkButton>
                        </td>
                        <td align="right">
                            <asp:Label ID="CurrentPageLabel" ForeColor="Blue" runat="server" />
                        </td>
                    </tr>
                </table>

            </PagerTemplate>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#EFF3FB" />
            <EditRowStyle BackColor="#2461BF" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" InsertMethod="Insert"
            OldValuesParameterFormatString="original_{0}" SelectCountMethod="GetBookCount"
            SelectMethod="GetBookInfo" TypeName="BookShop.BookController" UpdateMethod="Update" EnablePaging="True">
            <UpdateParameters>
                <asp:Parameter Name="Isbn" Type="String" />
                <asp:Parameter Name="BookName" Type="String" />
                <asp:Parameter Name="Author" Type="String" />
                <asp:Parameter Name="Publisher" Type="String" />
                <asp:Parameter Name="Price" Type="Decimal" />
                <asp:Parameter Name="CategoryID" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Isbn" Type="String" />
                <asp:Parameter Name="BookName" Type="String" />
                <asp:Parameter Name="Author" Type="String" />
                <asp:Parameter Name="Publisher" Type="String" />
                <asp:Parameter Name="Price" Type="Decimal" />
                <asp:Parameter Name="CategoryID" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
            </InsertParameters>
        </asp:ObjectDataSource>
            </ContentTemplate>
        </asp:UpdatePanel>
        &nbsp;&nbsp;<br />
        <?xml namespace="" prefix="ajaxToolkit" ?>
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/TransArrage.aspx?source=BH0120090607001">HyperLink</asp:HyperLink></div>
    </form>
</body>
</html>
